import request from '@/utils/request'

const API = {
    ADD: '/article/article/add', // 发送文章
    UPDATE: '/article/article/update', // 编辑文章
    DELETE: '/article/article/delete', // 删除文章
    QUERY_PAGE: '/article/article/queryPage', // 文章分页查询
    QUERY_DETAIL: '/article/article/queryInfo', // 文章详情查询
    QUERY_CATEGORY: '/article/articleCategory/query',// 查询所有分类
    QUERY_TAG: '/article/articleTag/query',// 查询所有标签
    ADD_VIEW: '/article/article/addView/', // 新增文章阅读
    DO_LIKE: '/article/article/like/', // 文章点赞
    QUERY_COMMENT: '/article/comment/query/',// 查询文章评论
    ADD_COMMENT: '/article/comment/add', // 新增文章评论
    QYERY_ARTICLE_RANK: '/article/article/articleRank', // 查询文章榜单
    QYERY_AUTHOR_RANK: '/article/article/authorRank', // 查询文章作者榜单

}

export const reqAdd = (entity) => request.post(API.ADD, entity)

export const reqUpdate = (entity) => request.post(API.UPDATE, entity)

export const reqDelete = (entity) => request.post(API.DELETE, entity)

export const reqQueryPage = (entity) => request.post(API.QUERY_PAGE, entity)

export const reqQueryDetail = (entity) => request.post(API.QUERY_DETAIL, entity)

export const reqQueryCategory = () => request.get(API.QUERY_CATEGORY)

export const reqQueryTag = () => request.get(API.QUERY_TAG)

export const reqAddView = (id) => request.post(API.ADD_VIEW + id)

export const reqDoLike = (id) => request.post(API.DO_LIKE + id)

export const reqArticleComments = (id) => request.get(API.QUERY_COMMENT + id)

export const reqAddComment = (entity) => request.post(API.ADD_COMMENT, entity)

export const reqQueryArticleRank = (entity) => request.post(API.QYERY_ARTICLE_RANK, entity)

export const reqQueryAuthorRank = () => request.get(API.QYERY_AUTHOR_RANK)

